<script setup lang="ts">
//行为

import type { Goods } from "../types";

interface Emit{

  // 函数重载
  (e: 'get-msg', value: string): void
  (e: 'get-list', value: Goods[]): void
}


// //导出类型复用
// export interface Goods {
//   id: number;
//   name: string;
// }

//为组件的emit标注类型
const emit = defineEmits<Emit>();
</script>

<template>
<!--结构 -->
  <button @click="emit('get-msg', '我是子组件')">子传父</button>
  <button @click="emit('get-list', [{id: 1, name: '冬季衣服'}])">子传父--传对象数组</button>
</template>
